<template>
  <a-card>
    <detail-list :col="4">
      <detail-list-item :term="$t('key.ssyx')">{{ detail.kkyxm | filterYx(yxList) }}</detail-list-item>
      <detail-list-item :term="$t('key.rkjs')">{{ detail.dsbhxm }}</detail-list-item>
      <detail-list-item :term="$t('key.kcdm')">{{ detail.kcbm }}</detail-list-item>
      <detail-list-item :term="$t('key.kcmc')">{{ detail.kcmc }}</detail-list-item>
      <detail-list-item :term="$t('key.yrkjs')">{{ detail.yrkjs }}</detail-list-item>
      <detail-list-item :term="$t('key.tzhjs')">{{ detail.tzhjs }}</detail-list-item>
      <detail-list-item :term="$t('key.yskzlxmc')">{{ detail.yskzlxmc }}</detail-list-item>
      <detail-list-item :term="$t('key.tzhskzlxmc')">{{ detail.tzhskzlxmc }}</detail-list-item>
      <detail-list-item :term="$t('key.yskzmc')">{{ detail.yskzmc }}</detail-list-item>
      <detail-list-item :term="$t('key.tzhskzmc')">{{ detail.tzhskzmc }}</detail-list-item>
      <detail-list-item :term="$t('key.yksz')">{{ detail.yksz }}</detail-list-item>
      <detail-list-item :term="$t('key.tzhksz')">{{ detail.tzhksz }}</detail-list-item>
      <detail-list-item :term="$t('key.yjsz')">{{ detail.yjsz }}</detail-list-item>
      <detail-list-item :term="$t('key.tzhjsz')">{{ detail.tzhjsz }}</detail-list-item>
      <detail-list-item :term="$t('key.ykskj')">{{ detail.ykskj }}</detail-list-item>
      <detail-list-item :term="$t('key.tzhkskj')">{{ detail.tzhkskj }}</detail-list-item>
      <detail-list-item :term="$t('key.yjskj')">{{ detail.yjskj }}</detail-list-item>
      <detail-list-item :term="$t('key.tzhjskj')">{{ detail.tzhjskj }}</detail-list-item>
      <detail-list-item :term="$t('key.sqr')">{{ detail.sqr }}</detail-list-item>
      <detail-list-item :term="$t('key.shsj')">{{ detail.shsj && detail.shsj.format('YYYY-MM-DD') }} &nbsp;</detail-list-item>
      <detail-list-item :term="$t('key.shzt')">{{ detail.shzt | filterCode(TYPE0518) }}</detail-list-item>
      <detail-list-item :term="$t('key.shr')">{{ detail.shr }}</detail-list-item>
      <!-- <detail-list-item term="审核理由">{{ detail.ksrq && detail.ksrq.format('YYYY-MM-DD') }}</detail-list-item> -->
    </detail-list>
    <a-row style="text-align: center"> <a-button @click="$router.back()" type="primary">返回</a-button> </a-row>
  </a-card>
</template>

<script>

import DetailList from '~/tool/DetailList'
import { mapState } from 'vuex'
const DetailListItem = DetailList.Item

export default {
  components: {DetailList, DetailListItem},
  data () {
    return {
      detail: {},
      yxList: []
    }
  },
  filters: {
    filterCode(value, type) {
      let name = null
      type && type.map(item => {
        if(item.code === value) return name = item.name
      })
      return name
    },
    filterYx(value, yxList) {
      let name = null
      yxList.map(item => {
        if(item.dwh === value) return name = item.dwmc
      })
      return name
    }
  },
  // tkDetail
  computed: {
    ...mapState({
      TYPE0518: state => state.app['TYPE0518'],
    }),
  },
  created() {
    this.$store.dispatch('app/setDictionary', 'TYPE0518')
    this.$api.base.collegeAll().then(res => {
      this.yxList = res.data
    })
    this.getDetail(this.$route.query.id)
  },
  methods: {
    getDetail (id) {
      this.$api.cultivate.tkDetail(id).then(res => {
        this.detail = res.data
      })
    }
  }
}
</script>

<style>

</style>
